const fs = require('fs');
let mobile = "1133123456789"
console.log(1);
// 异步的方法,不会阻碍同步的执行
// 异步为了保障顺序,会发生回调地狱现象
fs.readFile("./chp07-01promise.txt","utf-8",(err,data) => {
  let arr = data.split("\r\n")
  let ren_arr =  arr[0].split(":")
  if (ren_arr[0]===mobile) {    
    let name = ren_arr[1];

    fs.readFile("./chp07-02promise.txt","utf-8",(err,data) => {
      let arr2 = data.split("\r\n")
      let ren_arr2 =  arr2[0].split(":")
      if (ren_arr2[0]===name) {   
        console.log(ren_arr2[1]);
      }
    })
  }
})

console.log(2);